GXGetShapeBounds
You can use theGXGetShapeBounds
function to determine the bounding rectangle of a shape or of a specified contour of a shape.
gxRectangle *GXGetShapeBounds(gxShape source, long index, gxRectangle *bounds);
source
- A reference to the shape containing the contour whose bounding rectangle you want to find.
index
- The number of the contour whose bounding rectangle you want to find. You may specify a value of 0 to indicate you want to find the bounding rectangle of the entire shape.
bounds
- A pointer to a
gxRectangle
structure. On return, this structure contains the bounding rectangle of the specified contour.- function result
- The bounding rectangle of the specified contour. (This value is the
same as the value returned in thebounds
parameter.)DESCRIPTION
TheGXGetShapeBounds
function determines the bounding rectangle of the contour specified by theindex
parameter of the shape specified by thesource
parameter. If you specify a value of 0 for theindex
parameter, this function finds the bounding rectangle of the entire source shape.The bounding rectangle of a shape (or of a contour of a shape) is the smallest rectangle that contains the geometry of the shape (or of the contour).
This function finds the bounding rectangle of the source shape (or a contour of the source shape) as defined by the source shape's geometry; it does not consider shape fill or transformations to the shape made by the shape's transform.
For empty shapes and full shapes, this function posts the warning
shape_passed_has_no_bounds
. For full shapes, it returns an infinitely large rectangle; for empty shapes, it returns the inverse rectangle.If you provide a target shape that is not one of the geometric shape types, this function performs the actions described in the following table:
Shape type Action taken bitmap Returns the bounding rectangle picture Returns the bounding rectangle for the entire picture text Returns bounding rectangle of specified glyphs glyph Returns bounding rectangle of specified glyphs layout Posts the error functionality_unimplemented
if the index parameter is not zero; returns bounding rectangle of glyphs otherwiseERRORS, WARNINGS, AND NOTICES
Errors out_of_memory shape_is_nil contour_is_less_than_zero parameter_is_nil (debugging version) functionality_unimplemented (debugging version) Warnings contour_out_of_range shape_passed_has_no_bounds (debugging version) unable_to_traverse_open_contour_that_starts_or_ends_off_the_curve (debugging version) SEE ALSO
For a discussion of rectangles and bounding rectangles, see Chapter 2, "Geometric Shapes," in this book.To find the center of a shape or a contour of a shape, use the
GXGetShapeCenter
function, which is described on page 4-87.To change the bounding rectangle of a shape, use the
GXSetShapeBounds
function, described in the next section.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help